﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections;

namespace RandomDemo.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class WeatherForecastController : ControllerBase
    {
        Models.RandomDataBaseContext _db;
        private static readonly string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };

        private readonly ILogger<WeatherForecastController> _logger;

        public WeatherForecastController(ILogger<WeatherForecastController> logger, Microsoft.EntityFrameworkCore.DbContext db)
        {
            _logger = logger;
            _db = db as Models.RandomDataBaseContext;
        }

        [HttpGet]
        public ResultClass Get()
        {
            Models.RandomDataBaseContext db = new Models.RandomDataBaseContext();
            P.ObjectHelper objectHelper = new P.ObjectHelper();
            
            return new ResultClass { Code = 200, Message = "aaaa", Result = db.SysRoles.ToList<Models.SysRole>() };
        }
    }

    public class ResultClass
    {
        public int Code { get; set; }

        public string Message { get; set; }

        public object Result { get; set; }
    }
}
